Skip to content
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[{*.php,*.json,*.md,*.html,*.css,*.js,*.yml}]
indent_style = space
indent_size = 4
64 changes: 64 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: PHP Composer

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

permissions:
contents: read

jobs:
tests:

runs-on: ubuntu-latest

strategy:
matrix:
dependencies: [ "lowest", "normal" ]

steps:
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.dependencies }}-

- name: Install dependencies (mode ${{ matrix.dependencies }})
run: |
if [ "${{ matrix.dependencies }}" = "lowest" ]; then
composer update --prefer-lowest --prefer-dist --no-progress
else
composer install --prefer-dist --no-progress
fi

- name: Enable Xdebug
run: echo "XDEBUG_MODE=coverage" >> $GITHUB_ENV

- name: Run test suite
run: vendor/bin/phpunit --coverage-clover coverage.xml --log-junit junit.xml

- name: Upload test results to Codecov
if: ${{ !cancelled() && matrix.dependencies == 'normal' }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

- name: Upload coverage to Codecov
if: ${{ !cancelled() && matrix.dependencies == 'normal' }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: php
fail_ci_if_error: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
vendor
composer.lock
.phpunit.cache
.phpunit.result.cache
.php-cs-fixer.cache
clover.xml
junit.xml
coverage.xml
27 changes: 27 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = (new Finder())
->ignoreDotFiles(false)
->ignoreVCSIgnored(true)
->in(__DIR__)
;

return (new Config())
->setRiskyAllowed(true)
->setRules([
'@PHP74Migration' => true,
'@PHP74Migration:risky' => true,
'@PHPUnit100Migration:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => false,
'yoda_style' => true,
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
'modernize_strpos' => true, // needs PHP 8+ or polyfill
'no_useless_concat_operator' => false, // TODO switch back on when the `src/Console/Application.php` no longer needs the concat
])
->setFinder($finder)
;
63 changes: 0 additions & 63 deletions .travis.yml

This file was deleted.

14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
default: install test stan

install:
composer install

test:
vendor/bin/phpunit

cs:
vendor/bin/php-cs-fixer fix -vvv

analyse: test
vendor/bin/phpmetrics --junit --report-html=docs/phpmetrics/index.html src
vendor/bin/phpstan
86 changes: 51 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,54 @@
{
"name": "symftony/xpression",
"authors": [
{
"name": "Anthony",
"email": "symftony@gmail.com"
"name": "symftony/xpression",
"authors": [
{
"name": "Anthony",
"email": "symftony@gmail.com"
}
],
"type": "library",
"description": "Xpression is a simple PHP implementation of Specification pattern",
"keywords": [
"dsl",
"doctrine",
"orm",
"mongodb",
"collections",
"specification",
"expression",
"parser",
"lexer",
"query",
"builder",
"query builder"
],
"homepage": "https://github.com/symftony/Xpression",
"require": {
"php": "^8.0",
"doctrine/lexer": "^1.2.1"
},
"require-dev": {
"doctrine/collections": "^1.8.0",
"doctrine/orm": "^2.8.0",
"phpspec/prophecy": "^1.18",
"phpunit/phpunit": "^9.6",
"friendsofphp/php-cs-fixer": "^3.41",
"phpstan/phpstan": "^1.10",
"phpmetrics/phpmetrics": "^2.8"
},
"suggest": {
"doctrine/collections": "If you want filter an ArrayCollection",
"doctrine/orm": "If you want filter an ORM query builder"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Symftony\\Xpression\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Symftony\\Xpression\\": "tests/"
}
}
],
"type": "library",
"description": "Xpression is a simple PHP implementation of Specification pattern",
"keywords": ["dsl", "doctrine", "orm", "mongodb", "collections", "specification", "expression", "parser", "lexer", "query", "builder", "query builder"],
"homepage": "https://github.com/symftony/Xpression",
"require": {
"php": ">=5.3",
"doctrine/lexer": "^1.0"
},
"require-dev": {
"phpunit/phpunit": ">=4.8.35",
"doctrine/collections": "^1.0",
"doctrine/orm": "^2.4.0"
},
"suggest": {
"doctrine/collections": "If you want filter an ArrayCollection",
"doctrine/orm": "If you want filter an ORM query builder",
"doctrine/mongodb": "If you want filter an Mongodb query builder"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Symftony\\Xpression\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Symftony\\Xpression\\": "tests/"
}
}
}
10 changes: 10 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Symftony Xpression</title>
</head>
<body>
WIP github pages
</body>
</html>
8 changes: 8 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
parameters:
level: 6
paths:
- src
ignoreErrors:
- '/Method .*::(in|notIn|andX|nandX|orX|norX|xorX)\(\) has parameter .* with no value type specified in iterable type array\./'
- '/Method Symftony\\Xpression\\Parser::getNextToken\(\) return type has no value type specified in iterable type array\./'
- '/Method Symftony\\Xpression\\Lexer::get(Non)?CatchablePatterns\(\) return type has no value type specified in iterable type array\./'
30 changes: 30 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>src/Exception</directory>
</exclude>
</coverage>
</phpunit>
29 changes: 0 additions & 29 deletions phpunit.xml.dist

This file was deleted.

Loading