Skip to content

Commit

Permalink
Merge branch 'master' into fix-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmiu committed Mar 11, 2024
2 parents 21da751 + b3c2bb4 commit a4daee9
Show file tree
Hide file tree
Showing 28 changed files with 830 additions and 731 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: 🐛 Bug
about: Did you encounter a bug?
---

### Bug Report

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| BC Break | yes/no
| Version | x.y.z

#### Summary

<!-- Provide a summary describing the problem you are experiencing. -->

#### How to reproduce

<!--
Provide steps to reproduce the issue.
If possible, also add a code snippet.
-->
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_Request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 🎉 Feature Request
about: Do you have a new feature in mind?
---

### Feature Request

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| New Feature | yes/no
| BC Break | yes/no

#### Scenario / Use-case

<!-- Provide an explain in which scenario the feature would be helpful. -->

#### Summary

<!-- Provide a summary of the feature you would like to see implemented. -->
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/Question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: ❓ Question
about: Are you unsure about something?
---

### Question

<!-- Fill in the relevant information below to help triage your issue. -->
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
include:
- php: '8.1'
send-to-scrutinizer: 'yes'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2
with:
send-to-scrutinizer: 'no'
phpunit-flags: '--no-coverage'
php-version: ${{ matrix.php }}
coverage: xdebug
env:
fail-fast: true
- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test suite
run: |
composer run stan
sudo composer run test
28 changes: 28 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish docs

on:
push:
tags:
- '*.*.*'
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Build docs
run: |
curl -OS https://couscous.io/couscous.phar
php couscous.phar generate --target=build/docs/ ./docs
- name: FTP Deployer
uses: sand4rt/ftp-deployer@v1.1
with:
host: ${{ secrets.DOCS_FTP_HOST }}
username: ${{ secrets.DOCS_FTP_USER }}
password: ${{ secrets.DOCS_FTP_PASSWORD }}
remote_folder: upload
# The local folder location
local_folder: build/docs/
# Remove existing files inside FTP remote folder
cleanup: false # optional
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
.buildpath
.project
build/
tests/fixitures/
vendor/
composer.lock
atlassian-ide-plugin.xml
Expand Down
1 change: 1 addition & 0 deletions .php_cs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"7.2.4","version":"2.16.1","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"src\\Container\\ContainerInterface.php":1583588918,"src\\Container\\Local.php":71709479,"src\\Exception\\InvalidContainerException.php":1907413747,"src\\Exception\\InvalidResultException.php":466931389,"src\\Handler.php":534695839,"src\\HandlerAggregate.php":1499917949,"src\\Result\\Collection.php":2897468334,"src\\Result\\File.php":1434642790,"src\\UploadHandlerInterface.php":2299182802,"src\\Util\\Arr.php":1378696061,"src\\Result\\ResultInterface.php":844276353,"src\\Util\\Helper.php":3774982220}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Source Code](https://img.shields.io/badge/source-siriusphp/upload-blue.svg?style=flat-square)](https://github.com/siriusphp/upload)
[![Latest Version](https://img.shields.io/packagist/v/siriusphp/upload.svg?style=flat-square)](https://github.com/siriusphp/upload/releases)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/siriusphp/upload/blob/master/LICENSE)
[![Build Status](https://img.shields.io/travis/siriusphp/upload/master.svg?style=flat-square)](https://travis-ci.org/siriusphp/upload)
[![Build Status](https://github.com/siriusphp/upload/actions/workflows/ci.yml/badge.svg)](https://github.com/siriusphp/upload/actions/workflows/ci.yml)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/siriusphp/upload.svg?style=flat-square)](https://scrutinizer-ci.com/g/siriusphp/upload/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/siriusphp/upload.svg?style=flat-square)](https://scrutinizer-ci.com/g/siriusphp/upload)
[![Total Downloads](https://img.shields.io/packagist/dt/siriusphp/upload.svg?style=flat-square)](https://packagist.org/packages/siriusphp/upload)
Expand Down
36 changes: 19 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
}
],
"require": {
"php": ">=7.1",
"siriusphp/validation": "~3.0"
"php": ">=8.1",
"siriusphp/validation": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "~8.5",
"laminas/laminas-diactoros": "^2.2",
"symfony/http-foundation": "^4.4"
"laminas/laminas-diactoros": "^3.3",
"symfony/http-foundation": "^6.3",
"pestphp/pest": "^2.24",
"pestphp/pest-plugin-drift": "^2.5",
"symfony/mime": "^6.3",
"phpstan/phpstan": "^1.10"
},
"suggest": {
"league/flysystem": "To upload to different destinations, not just to the local file system",
Expand All @@ -37,26 +40,25 @@
}
},
"scripts": {
"cs": [
"php phpcs.phar --standard=PSR2 ./src"
],
"md": [
"php phpmd.phar ./src xml phpmd.xml"
],
"cbf": [
"php phpcbf.phar ./src --standard=PSR2 -w"
"stan": [
"php vendor/bin/phpstan analyse"
],
"csfix": [
"php php-cs-fixer.phar fix ./src --rules=@PSR2"
"tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --standard=PSR-2 src"
],
"test": [
"php vendor/bin/pest"
],
"build-docs": [
"php couscous.phar generate --target=build/docs/ ./docs"
],
"docs": [
"cd docs && php ../couscous.phar preview"
],
"test": [
"vendor/bin/phpunit -c phpunit.xml"
]
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Latest Version](https://img.shields.io/packagist/v/siriusphp/upload.svg?style=flat-square)](https://github.com/siriusphp/upload/releases)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/siriusphp/upload/blob/master/LICENSE)
[![Build Status](https://img.shields.io/travis/siriusphp/upload/master.svg?style=flat-square)](https://travis-ci.org/siriusphp/upload)
[![PHP 7 ready](http://php7ready.timesplinter.ch/siriusphp/upload/master/badge.svg)](https://travis-ci.org/siriusphp/upload)
[![PHP 7 ready](https:////php7ready.timesplinter.ch/siriusphp/upload/master/badge.svg)](https://travis-ci.org/siriusphp/upload)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/siriusphp/upload.svg?style=flat-square)](https://scrutinizer-ci.com/g/siriusphp/upload/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/siriusphp/upload.svg?style=flat-square)](https://scrutinizer-ci.com/g/siriusphp/upload)
[![Total Downloads](https://img.shields.io/packagist/dt/siriusphp/upload.svg?style=flat-square)](https://packagist.org/packages/siriusphp/upload)
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 8
checkGenericClassInNonGenericObjectType: false
paths:
- src
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./app</directory>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
17 changes: 5 additions & 12 deletions src/Container/ContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,28 @@ interface ContainerInterface
/**
* Check if the container is writable
*/
public function isWritable();
public function isWritable(): bool;

/**
* This will check if a file is in the container
*
* @param string $file
*/
public function has($file);
public function has(string $file): bool;

/**
* Saves the $content string as a file
*
* @param string $file
* @param string $content
*/
public function save($file, $content);
public function save(string $file, string $content): bool;

/**
* Delete the file from the container
*
* @param string $file
*/
public function delete($file);
public function delete(string $file): bool;

/**
* Moves a temporary uploaded file to a destination in the container
*
* @param string $localFile local path
* @param string $destination
*/
public function moveUploadedFile($localFile, $destination);
public function moveUploadedFile(string $localFile, string $destination): bool;
}

0 comments on commit a4daee9

Please sign in to comment.