Skip to content
Merged
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
20 changes: 9 additions & 11 deletions .github/workflows/ci-scheduled.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: CI (scheduled)
on:
schedule:
- cron: 0 14 * * 0 # Sunday 2PM UTC = Monday 12AM AEST
- cron: * 14 * * 0 # Every day 2PM UTC = Monday 12AM AEST
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
php: ['8.2', '8.3', '8.4', '8.5']
name: PHP ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -22,13 +22,11 @@ jobs:
- name: Check PHP version
run: php -v
- name: Install dependencies
run: make vendor
- name: Make
if: ${{ startsWith(matrix.php, '7.') }}
run: make ci
- name: Make
if: ${{ startsWith(matrix.php, '8.') }}
run: make artifacts/coverage/phpunit/clover.xml
run: composer install --no-interaction --prefer-dist
- name: Run tests with coverage
run: |
mkdir -p artifacts/test artifacts/coverage/phpunit
vendor/bin/phpunit -c phpunit.xml --coverage-clover artifacts/coverage/phpunit/clover.xml
- name: Publish coverage
if: success()
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
php: ['8.2', '8.3', '8.4', '8.5']
name: PHP ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -22,13 +22,11 @@ jobs:
- name: Check PHP version
run: php -v
- name: Install dependencies
run: make vendor
- name: Make
if: ${{ startsWith(matrix.php, '7.') }}
run: make ci
- name: Make
if: ${{ startsWith(matrix.php, '8.') }}
run: make artifacts/coverage/phpunit/clover.xml
run: composer install --no-interaction --prefer-dist
- name: Run tests with coverage
run: |
mkdir -p artifacts/test artifacts/coverage/phpunit
vendor/bin/phpunit -c phpunit.xml --coverage-clover artifacts/coverage/phpunit/clover.xml
- name: Publish coverage
if: success()
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
10 changes: 10 additions & 0 deletions .idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
> # No longer maintained
>
> This package is no longer maintained. See [this statement] for more info.
>
> [this statement]: https://gist.github.com/ezzatron/713a548735febe3d76f8ca831bc895c0

# Pops

*PHP Object Proxy System.*

This is a maintained fork of [eloquent/pops] originally created by Erin Millard.

## Installation and documentation

* Available as [Composer] package [eloquent/pops].
* Available as [Composer] package `vedavith/pops-fork` (maintained fork of `eloquent/pops`).
* Requires PHP 8.2 or later.

## What is *Pops*?

Expand Down Expand Up @@ -45,12 +42,12 @@ use Eloquent\Pops\ProxyObject;

class UppercaseProxyObject extends ProxyObject
{
public function popsCall($method, array &$arguments)
public function popsCall(string $method, array &$arguments): mixed
{
return strtoupper(parent::popsCall($method, $arguments));
}

public function __get($property)
public function __get(string $property): mixed
{
return strtoupper(parent::__get($property));
}
Expand Down Expand Up @@ -148,7 +145,7 @@ class OutputEscaperProxyArray extends ProxyArray
*
* @return string The proxy class.
*/
protected static function popsProxyClass()
protected static function popsProxyClass(): string
{
return __NAMESPACE__ . '\OutputEscaperProxy';
}
Expand All @@ -170,7 +167,7 @@ class OutputEscaperProxyClass extends ProxyClass
*
* @return string The proxy class.
*/
protected static function popsProxyClass()
protected static function popsProxyClass(): string
{
return __NAMESPACE__ . '\OutputEscaperProxy';
}
Expand All @@ -192,7 +189,7 @@ class OutputEscaperProxyObject extends ProxyObject
*
* @return string The proxy class.
*/
protected static function popsProxyClass()
protected static function popsProxyClass(): string
{
return __NAMESPACE__ . '\OutputEscaperProxy';
}
Expand All @@ -214,7 +211,7 @@ class OutputEscaperProxyPrimitive extends ProxyPrimitive
*
* @return string The HTML-secaped version of this primitive.
*/
public function __toString()
public function __toString(): string
{
return htmlspecialchars(
strval($this->popsValue()),
Expand Down
23 changes: 18 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
{
"name": "eloquent/pops",
"description": "PHP object proxy system.",
"name": "vedavith/pops-fork",
"description": "Maintained fork of eloquent/pops, a PHP object proxy system.",
"keywords": ["object", "proxy", "method", "property"],
"homepage": "https://github.com/eloquent/pops",
"homepage": "https://github.com/vedavith/pops-fork",
"license": "MIT",
"support": {
"issues": "https://github.com/vedavith/pops-fork/issues",
"source": "https://github.com/vedavith/pops-fork"
},
"replace": {
"eloquent/pops": "self.version"
},
"authors": [
{
"name": "Erin Millard",
"email": "ezzatron@gmail.com",
"homepage": "http://ezzatron.com/"
},
{
"name": "Vedavith Ravula",
"email": "veda_ravula@outlook.com"
}
],
"require": {
"php": "^7.4 || ^8"
"php": "^8.2"
},
"require-dev": {
"eloquent/code-style": "^2",
"errors/exceptions": "^0.2",
"friendsofphp/php-cs-fixer": "^3",
"phpunit/phpunit": "^9"
"phpunit/phpunit": "^11.3 || ^12",
"ext-mbstring": "*",
"phpunit/php-code-coverage": "^11 || ^12"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 3 additions & 4 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<phpunit
bootstrap="vendor/autoload.php"
cacheResultFile="artifacts/test/phpunit.result.cache"
colors="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
convertErrorsToExceptions="true"
verbose="true"
>
<testsuites>
<testsuite name="main">
Expand All @@ -18,11 +15,13 @@
<report>
<text outputFile="php://stdout" showOnlySummary="true"/>
</report>
</coverage>

<source>
<include>
<directory>src</directory>
</include>
</coverage>
</source>

<php>
<ini name="error_reporting" value="-1"/>
Expand Down
10 changes: 5 additions & 5 deletions src/AbstractProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractProxy implements ProxyInterface
*
* @throws Exception\InvalidTypeException If the supplied value is not the correct type.
*/
public function __construct($value)
public function __construct(mixed $value)
{
$this->setPopsValue($value);
}
Expand All @@ -35,7 +35,7 @@ public function __construct($value)
*
* @throws Exception\InvalidTypeException If the supplied value is not the correct type.
*/
public function setPopsValue($value)
public function setPopsValue(mixed $value): void
{
$this->assertPopsValue($value);

Expand All @@ -47,7 +47,7 @@ public function setPopsValue($value)
*
* @return mixed The wrapped value.
*/
public function popsValue()
public function popsValue(): mixed
{
return $this->value;
}
Expand All @@ -60,7 +60,7 @@ public function popsValue()
*
* @throws Exception\InvalidTypeException If the supplied value is not the correct type.
*/
abstract protected function assertPopsValue($value);
abstract protected function assertPopsValue(mixed $value): void;

private $value;
private mixed $value;
}
20 changes: 9 additions & 11 deletions src/AbstractTraversableProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractTraversableProxy extends AbstractProxy implements
*
* @throws Exception\InvalidTypeException If the supplied value is not the correct type.
*/
public function __construct($value, $isRecursive = null)
public function __construct(mixed $value, ?bool $isRecursive = null)
{
if (null === $isRecursive) {
$isRecursive = false;
Expand All @@ -43,7 +43,7 @@ public function __construct($value, $isRecursive = null)
*
* @return bool True if the wrapped value is recursively proxied.
*/
public function isPopsRecursive()
public function isPopsRecursive(): bool
{
return $this->isPopsRecursive;
}
Expand All @@ -53,8 +53,7 @@ public function isPopsRecursive()
*
* @return mixed The current value.
*/
#[\ReturnTypeWillChange]
public function current()
public function current(): mixed
{
return $this->popsProxySubValue($this->popsInnerIterator()->current());
}
Expand All @@ -64,8 +63,7 @@ public function current()
*
* @return mixed The current key.
*/
#[\ReturnTypeWillChange]
public function key()
public function key(): mixed
{
return $this->popsInnerIterator()->key();
}
Expand Down Expand Up @@ -103,7 +101,7 @@ public function valid(): bool
*
* @return mixed The proxied value, or the untouched value.
*/
protected function popsProxySubValue($value)
protected function popsProxySubValue(mixed $value): mixed
{
if ($this->isPopsRecursive()) {
$popsClass = static::popsProxyClass();
Expand All @@ -119,7 +117,7 @@ protected function popsProxySubValue($value)
*
* @return Iterator An iterator for the wrapped object.
*/
protected function popsInnerIterator()
protected function popsInnerIterator(): Iterator
{
if (null === $this->popsInnerIterator) {
$this->popsInnerIterator = $this->popsCreateInnerIterator();
Expand All @@ -133,8 +131,8 @@ protected function popsInnerIterator()
*
* @return Iterator An iterator for the wrapped object.
*/
abstract protected function popsCreateInnerIterator();
abstract protected function popsCreateInnerIterator(): Iterator;

private $isPopsRecursive;
private $popsInnerIterator;
private bool $isPopsRecursive;
private ?Iterator $popsInnerIterator = null;
}
Loading