Skip to content

Commit

Permalink
Merge pull request #2 from Mad-Collective/PHP8-compatibility
Browse files Browse the repository at this point in the history
PHP8 compatibility
  • Loading branch information
marcmascarell-mad authored Jun 12, 2024
2 parents 3522433 + 6d34e42 commit d792b52
Show file tree
Hide file tree
Showing 10 changed files with 1,309 additions and 417 deletions.
22 changes: 21 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
/vendor/
/bin/code-coverage
/bin/clover.xml
/bin/phpspec
/bin/phpspec

/data/

.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

/.idea/

.php_cs.cache

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
COMPONENT := featurebalancer
CONTAINER := phpfarm
CONTAINER := phpcli
IMAGES ?= false
PHP_VERSION ?: false
APP_ROOT := /app/feature-balancer
Expand All @@ -8,10 +8,10 @@ CODE_COVERAGE_FORMAT ?= clover
all: dev logs

dev:
@docker-compose -p ${COMPONENT} -f ops/docker/docker-compose.yml up -d
@docker-compose -p ${COMPONENT} -f ops/docker/docker-compose.yml up -d --build

enter:
@docker exec -ti ${COMPONENT}_${CONTAINER}_1 /bin/bash
@docker exec -ti ${COMPONENT}_${CONTAINER}_1 /bin/sh

kill:
@docker-compose -p ${COMPONENT} -f ops/docker/docker-compose.yml kill
Expand Down Expand Up @@ -44,4 +44,4 @@ logs:
tag: # List last tag for this repo
@git tag -l | sort -r |head -1

restart: nodev dev logs
restart: nodev dev logs
119 changes: 119 additions & 0 deletions bin/yaml-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env php
<?php

/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../vendor/symfony/yaml/Resources/bin/yaml-lint)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/

namespace Composer;

$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/vendor/autoload.php';

if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;

public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;

return (bool) $this->handle;
}

public function stream_read($count)
{
$data = fread($this->handle, $count);

if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}

$this->position += strlen($data);

return $data;
}

public function stream_cast($castAs)
{
return $this->handle;
}

public function stream_close()
{
fclose($this->handle);
}

public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}

public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}

return false;
}

public function stream_tell()
{
return $this->position;
}

public function stream_eof()
{
return feof($this->handle);
}

public function stream_stat()
{
return array();
}

public function stream_set_option($option, $arg1, $arg2)
{
return true;
}

public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}

return false;
}
}
}

if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/vendor/symfony/yaml/Resources/bin/yaml-lint');
}
}

return include __DIR__ . '/..'.'/vendor/symfony/yaml/Resources/bin/yaml-lint';
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
}
],
"require": {
"php": ">=5.5",
"psr/log": "^1.0"
"php": "^8.0",
"psr/log": "^2.0"
},
"require-dev": {
"phpspec/phpspec": "^2.0",
"phpspec/phpspec": "^7.0",
"phpunit/php-code-coverage": "^2.2",
"pluggit/monitoring": "^2.0",
"coduo/phpspec-data-provider-extension": "^1.0"
"pluggit/monitoring": "^4.0.0"
},
"config": {
"bin-dir": "bin"
Expand Down
Loading

0 comments on commit d792b52

Please sign in to comment.