Skip to content

Commit

Permalink
Merge branch '6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed May 12, 2023
2 parents 2bb16fb + 9603aad commit 7852058
Show file tree
Hide file tree
Showing 24 changed files with 406 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .changes/6.x/6.5.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
### Changed

- [#358](https://github.com/llaville/php-compatinfo/issues/358) : build CHANGELOG automation - migrate from legacy script to changie tool
- we use the new `toHighlight` manifest builder available since v2.1.0 (see https://github.com/llaville/box-manifest/releases/tag/2.1.0)
- we use the new `toHighlight` manifest builder available since v2.1.0 (see <https://github.com/llaville/box-manifest/releases/tag/2.1.0>)

**Full Changelog**: [6.5.3...6.5.4](https://github.com/llaville/php-compatinfo/compare/6.5.3...6.5.4)
8 changes: 8 additions & 0 deletions .changes/6.x/6.5.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

## 6.5.5 - 2023-05-12

### Fixed

- [#359](https://github.com/llaville/php-compatinfo/issues/359) : new `setcookie` signature not recognized

**Full Changelog**: [6.5.4...6.5.5](https://github.com/llaville/php-compatinfo/compare/6.5.4...6.5.5)
24 changes: 18 additions & 6 deletions .changie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '- {{.Body}}'
kinds:
- label: Added
- label: Changed
- label: Deprecated
- label: Removed
- label: Fixed
- label: Security
-
label: Added
auto: minor
-
label: Changed
auto: minor
-
label: Deprecated
auto: patch
-
label: Removed
auto: minor
-
label: Fixed
auto: patch
-
label: Security
auto: patch
newlines:
afterHeaderTemplate: 0
beforeKind: 1
Expand Down
8 changes: 8 additions & 0 deletions .github/linters/phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ parameters:
- ../../src/
excludePaths:
- ../../src/Infrastructure/ManifestBuilder.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
-
message: "#^Method Bartlett\\\\CompatInfo\\\\Application\\\\Analyser\\\\CompatibilityAnalyser\\:\\:leave[a-zA-Z0-9\\_]+\\(\\) is unused\\.$#"
path: ../../src/Application/Analyser/CompatibilityAnalyser.php
-
message: "#^Method Bartlett\\\\CompatInfo\\\\Application\\\\Sniffs\\\\Keywords\\\\ReservedSniff\\:\\:enter[a-zA-Z0-9\\_]+\\(\\) is unused\\.$#"
path: ../../src/Application/Sniffs/Keywords/ReservedSniff.php
69 changes: 57 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,71 @@ name: Release

on:
push:
branches:
- "[0-9]+.[0-9]+"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

permissions:
contents: write

jobs:
tests:
uses: ./.github/workflows/unit-tests.yaml

build:
needs: tests

name: Create Release
uses: llaville/.github/.github/workflows/release.yml@master
with:
repository: ${{ github.repository }}
box-output: bin/phpcompatinfo.phar
release-draft: true
release-prerelease: ${{ github.ref_type == 'branch' }}
legacy: false
changie-changesDir: ".changes/6.x"
changie-command-args: "batch --keep --prerelease snapshot patch"
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
php:
- 8.1

steps:
- # Git Checkout
name: Checkout
uses: actions/checkout@v3

- # Setup PHP runtime
name: Setup PHP runtime
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- # Install Composer dependencies
name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--prefer-dist"

- # Prepare binary BOX Manifest commands
name: Download BOX Manifest Artifact
run: |
curl -Ls https://github.com/llaville/box-manifest/releases/latest/download/box-manifest.phar -o /usr/local/bin/box-manifest
chmod +x /usr/local/bin/box-manifest
- # Build the current release with artifacts (php archive)
name: Build Release Artifact
run: |
box-manifest manifest:build --ansi -vv -c box.json --output-file=sbom.json
box-manifest manifest:build --ansi -vv -c box.json --output-file=console.txt --format console
box-manifest manifest:stub --ansi -vv -c box.json --output-file=stub.php --resource console.txt --resource sbom.json
box-manifest box:compile --ansi -vv -c box.json.dist
- # Create a new Release (from a tag)
name: Create Release from current tag
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with: # https://github.com/softprops/action-gh-release#-customizing
prerelease: false
draft: true
body_path: ${{ github.workspace }}/.changes/6.x/${{ github.ref_name }}.md
# https://github.com/softprops/action-gh-release#%EF%B8%8F-uploading-release-assets
files: |
${{ github.workspace }}/bin/phpcompatinfo.phar
fail_on_unmatched_files: true
tag_name: ${{ github.ref_name }}
18 changes: 14 additions & 4 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:
os: ubuntu-latest
php: 7.4
extensions: json,pcre,pdo,phar,spl,mbstring,sqlite
tools: phpunit
tools: phpunit:9.6
-
os: ubuntu-latest
php: 8.0
extensions: json,pcre,pdo,phar,spl,mbstring,sqlite
tools: phpunit
tools: phpunit:9.6
-
os: ubuntu-latest
php: 8.1
Expand Down Expand Up @@ -68,6 +68,7 @@ jobs:
name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: "highest"
composer-options: "--prefer-dist --no-scripts"

- # Build Database
Expand All @@ -77,5 +78,14 @@ jobs:
bin/phpcompatinfo db:init --ansi
- # Run unit tests
name: Unit tests
run: phpunit --group features,large,reference,regression,default
name: Unit tests with PHPUnit 9
if: |
${{ matrix.php == '7.4' }} ||
${{ matrix.php == '8.0' }}
run: phpunit --group features,large,reference,regression,default --testdox --do-not-cache-result --configuration ./phpunit-9.xml
-
name: Unit tests with PHPUnit 10
if: |
${{ matrix.php == '8.1' }} ||
${{ matrix.php == '8.2' }}
run: phpunit --group features,large,reference,regression,default --testdox --do-not-cache-result
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vendor/

###### PHPUnit ######
.phpunit.result.cache
.phpunit.cache/

###### Mega-Linter ######
report/
Expand Down
4 changes: 3 additions & 1 deletion .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ PHP_PHPCS_CLI_LINT_MODE: project
PHP_PHPCS_CONFIG_FILE: ".phpcs.xml.dist"
PHP_PHPCS_ARGUMENTS: "-n"
PHP_PHPLINT_CLI_LINT_MODE: project
YAML_PRETTIER_FILTER_REGEX_EXCLUDE: "(mkdocs\\.yml|\\.github|\\.changie\\.yaml)" # As it cannot be added in .gitignore for ML actionlint linter
PHP_PHPLINT_ARGUMENTS: "--no-cache"
YAML_PRETTIER_FILTER_REGEX_EXCLUDE: "(mkdocs\\.yml|\\.github|\\.mega-linter\\.yml|\\.changie\\.yaml)" # As it cannot be added in .gitignore for ML actionlint linter
YAML_YAMLLINT_FILTER_REGEX_EXCLUDE: "(\\.github)" # As it cannot be added in .gitignore for ML actionlint linter
CONFIG_REPORTER: false
UPDATED_SOURCES_REPORTER: false
Expand All @@ -33,3 +34,4 @@ CONSOLE_REPORTER: true
LOG_FILE: mega-linter-v6.log
LOG_LEVEL: INFO
PRINT_ALL_FILES: false
PARALLEL: false # to avoid issue with MegaLinter v6.20.0 (see https://github.com/oxsecurity/megalinter/issues/2425)
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## 6.5.5 - 2023-05-12

### Fixed

- [#359](https://github.com/llaville/php-compatinfo/issues/359) : new `setcookie` signature not recognized

**Full Changelog**: [6.5.4...6.5.5](https://github.com/llaville/php-compatinfo/compare/6.5.4...6.5.5)

## 6.5.4 - 2022-12-14

### Changed

- [#358](https://github.com/llaville/php-compatinfo/issues/358) : build CHANGELOG automation - migrate from legacy script to changie tool
- we use the new `toHighlight` manifest builder available since v2.1.0 (see https://github.com/llaville/box-manifest/releases/tag/2.1.0)
- we use the new `toHighlight` manifest builder available since v2.1.0 (see <https://github.com/llaville/box-manifest/releases/tag/2.1.0>)

**Full Changelog**: [6.5.3...6.5.4](https://github.com/llaville/php-compatinfo/compare/6.5.3...6.5.4)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2010-2022, Laurent Laville <[email protected]>
Copyright (c) 2010-2023, Laurent Laville <[email protected]>

Credits to :

Expand Down
5 changes: 5 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"alias": "phpcompatinfo.phar",
"directories": ["bin", "config", "src", "vendor"],
"compression": "GZ"
}
7 changes: 6 additions & 1 deletion box.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"alias": "phpcompatinfo.phar",
"directories": ["bin", "config", "src", "vendor"],
"compression": "GZ",
"metadata": "Bartlett\\BoxManifest\\Composer\\ManifestFactory::toHighlight"
"stub": "stub.php",
"files-bin": ["sbom.json", "console.txt"],
"map": [
{ "console.txt": ".box.manifests/console.txt" },
{ "sbom.json": ".box.manifests/sbom.json" }
]
}
9 changes: 9 additions & 0 deletions config/set/php73.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* file that was distributed with this source code.
*/

use Bartlett\CompatInfo\Application\Sniffs\FunctionCalls\SameSiteCookieSniff;

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

/**
Expand All @@ -15,4 +17,11 @@
* @since Release 6.5.0
*/
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->defaults()
->autowire()
;

$services->set(SameSiteCookieSniff::class);
};
6 changes: 3 additions & 3 deletions docs/01_Components/03_Sniffs/Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ Here is the list of features supported and their corresponding sniffs :

## [PHP 7.3](https://www.php.net/manual/en/migration73.php)

| Sniff category | Sniff class name | PHP Feature |
|---|---|---|
| | | |
| Sniff category | Sniff class name | PHP Feature |
|----------------|---|--------------------------------------------------------------------------------------------------------------------------------------------|
| FunctionCalls | SameSiteCookieSniff | [SetCookie accept $options argument](https://www.php.net/manual/en/migration73.other-changes.php#migration73.other-changes.core.setcookie) |

## [PHP 7.4](https://www.php.net/manual/en/migration74.php)

Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ They are grouped by categories to solve PHP features (from 4.0 to 8.2)
- Enumerations (1)
- Expressions (3)
- Fibers (1)
- FunctionCalls (1)
- FunctionDeclarations (7)
- Generators (1)
- Keywords (1)
Expand Down
43 changes: 43 additions & 0 deletions phpunit-9.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="config/bootstrap.php"
colors="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnRisky="false"
stopOnSkipped="false"
verbose="true"
>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="parser">
<directory suffix="Test.php">tests/PhpParser/</directory>
</testsuite>
<testsuite name="reference">
<directory suffix="Test.php">tests/Reference/</directory>
</testsuite>
<testsuite name="sniffs">
<directory suffix="Test.php">tests/Sniffs/</directory>
</testsuite>
<testsuite name="features">
<directory suffix="IssueTest.php">tests/</directory>
<directory suffix="IssueTest.php">tests/PhpFeatures/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>large</group>
<group>not_implemented</group>
</exclude>
</groups>
<php>
<env name="APP_ENV" value="tests" force="true" />
</php>
</phpunit>
19 changes: 11 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="config/bootstrap.php"
colors="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnRisky="false"
stopOnSkipped="false"
verbose="true"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<coverage/>
<testsuites>
<testsuite name="parser">
<directory suffix="Test.php">tests/PhpParser/</directory>
Expand All @@ -38,6 +36,11 @@
</exclude>
</groups>
<php>
<env name="APP_ENV" value="tests" force="true" />
<env name="APP_ENV" value="tests" force="true"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit 7852058

Please sign in to comment.