Skip to content

Commit

Permalink
Updated Rector to commit c3f5cbca9f9c79f66f2a35accdd480875e62cf20
Browse files Browse the repository at this point in the history
rectorphp/rector-src@c3f5cbc [Php70] Fix with \r\n on EregToPregMatchRector (#6246)
  • Loading branch information
TomasVotruba committed Aug 21, 2024
1 parent 68889ac commit 082c3ba
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 30 deletions.
4 changes: 3 additions & 1 deletion rules/Php70/Rector/FuncCall/EregToPregMatchRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use RectorPrefix202408\Webmozart\Assert\Assert;
/**
* @see \Rector\Tests\Php70\Rector\FuncCall\EregToPregMatchRector\EregToPregMatchRectorTest
*/
Expand Down Expand Up @@ -89,7 +90,8 @@ private function processStringPattern(FuncCall $funcCall, String_ $string, strin
$pattern = $string->value;
$pattern = $this->eregToPcreTransformer->transform($pattern, $this->isCaseInsensitiveFunction($functionName));
$firstArg = $funcCall->getArgs()[0];
$firstArg->value = new String_($pattern);
Assert::isInstanceOf($firstArg->value, String_::class);
$firstArg->value->value = $pattern;
}
private function processVariablePattern(FuncCall $funcCall, Variable $variable, string $functionName) : void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '98f61597c8d6d0568ae3e5ee00ea826cc2e47aa2';
public const PACKAGE_VERSION = 'c3f5cbca9f9c79f66f2a35accdd480875e62cf20';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-08-20 14:30:28';
public const RELEASE_DATE = '2024-08-21 14:40:08';
/**
* @var int
*/
Expand Down
16 changes: 8 additions & 8 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -512,17 +512,17 @@
},
{
"name": "illuminate\/container",
"version": "v11.20.0",
"version_normalized": "11.20.0.0",
"version": "v11.21.0",
"version_normalized": "11.21.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/illuminate\/container.git",
"reference": "f47be671981a4438257c4fbfc3ad257f4e3e929a"
"reference": "4e353ac5dc1c61eb28e1d3721741989dd692df15"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/illuminate\/container\/zipball\/f47be671981a4438257c4fbfc3ad257f4e3e929a",
"reference": "f47be671981a4438257c4fbfc3ad257f4e3e929a",
"url": "https:\/\/api.github.com\/repos\/illuminate\/container\/zipball\/4e353ac5dc1c61eb28e1d3721741989dd692df15",
"reference": "4e353ac5dc1c61eb28e1d3721741989dd692df15",
"shasum": ""
},
"require": {
Expand All @@ -533,7 +533,7 @@
"provide": {
"psr\/container-implementation": "1.1|2.0"
},
"time": "2024-08-05T15:04:01+00:00",
"time": "2024-08-17T21:07:31+00:00",
"type": "library",
"extra": {
"branch-alias": {
Expand Down Expand Up @@ -569,8 +569,8 @@
},
{
"name": "illuminate\/contracts",
"version": "v11.20.0",
"version_normalized": "11.20.0.0",
"version": "v11.21.0",
"version_normalized": "11.21.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/illuminate\/contracts.git",
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions vendor/illuminate/container/BoundMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,32 @@ protected static function getCallReflector($callback)
*/
protected static function addDependencyForCallParameter($container, $parameter, array &$parameters, &$dependencies)
{
$pendingDependencies = [];
if (\array_key_exists($paramName = $parameter->getName(), $parameters)) {
$dependencies[] = $parameters[$paramName];
$pendingDependencies[] = $parameters[$paramName];
unset($parameters[$paramName]);
} elseif ($attribute = Util::getContextualAttributeFromDependency($parameter)) {
$pendingDependencies[] = $container->resolveFromAttribute($attribute);
} elseif (!\is_null($className = Util::getParameterClassName($parameter))) {
if (\array_key_exists($className, $parameters)) {
$dependencies[] = $parameters[$className];
$pendingDependencies[] = $parameters[$className];
unset($parameters[$className]);
} elseif ($parameter->isVariadic()) {
$variadicDependencies = $container->make($className);
$dependencies = \array_merge($dependencies, \is_array($variadicDependencies) ? $variadicDependencies : [$variadicDependencies]);
$pendingDependencies = \array_merge($pendingDependencies, \is_array($variadicDependencies) ? $variadicDependencies : [$variadicDependencies]);
} else {
$dependencies[] = $container->make($className);
$pendingDependencies[] = $container->make($className);
}
} elseif ($parameter->isDefaultValueAvailable()) {
$dependencies[] = $parameter->getDefaultValue();
$pendingDependencies[] = $parameter->getDefaultValue();
} elseif (!$parameter->isOptional() && !\array_key_exists($paramName, $parameters)) {
$message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}";
throw new BindingResolutionException($message);
}
foreach ($pendingDependencies as $dependency) {
$container->fireAfterResolvingAttributeCallbacks(\method_exists($parameter, 'getAttributes') ? $parameter->getAttributes() : [], $dependency);
}
$dependencies = \array_merge($dependencies, $pendingDependencies);
}
/**
* Determine if the given string is in Class@method syntax.
Expand Down
16 changes: 3 additions & 13 deletions vendor/illuminate/container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ protected function resolveDependencies(array $dependencies)
continue;
}
$result = null;
if (!\is_null($attribute = $this->getContextualAttributeFromDependency($dependency))) {
if (!\is_null($attribute = Util::getContextualAttributeFromDependency($dependency))) {
$result = $this->resolveFromAttribute($attribute);
}
// If the class is null, it means the dependency is a string or some other
Expand Down Expand Up @@ -908,16 +908,6 @@ protected function getLastParameterOverride()
{
return \count($this->with) ? \end($this->with) : [];
}
/**
* Get a contextual attribute from a dependency.
*
* @param ReflectionParameter $dependency
* @return \ReflectionAttribute|null
*/
protected function getContextualAttributeFromDependency($dependency)
{
return (\method_exists($dependency, 'getAttributes') ? $dependency->getAttributes(ContextualAttribute::class, ReflectionAttribute::IS_INSTANCEOF) : [])[0] ?? null;
}
/**
* Resolve a non-class hinted primitive dependency.
*
Expand Down Expand Up @@ -986,7 +976,7 @@ protected function resolveVariadicClass(ReflectionParameter $parameter)
* @param \ReflectionAttribute $attribute
* @return mixed
*/
protected function resolveFromAttribute(ReflectionAttribute $attribute)
public function resolveFromAttribute(ReflectionAttribute $attribute)
{
$handler = $this->contextualAttributes[$attribute->getName()] ?? null;
$instance = $attribute->newInstance();
Expand Down Expand Up @@ -1156,7 +1146,7 @@ protected function fireAfterResolvingCallbacks($abstract, $object)
* @param mixed $object
* @return void
*/
protected function fireAfterResolvingAttributeCallbacks(array $attributes, $object)
public function fireAfterResolvingAttributeCallbacks(array $attributes, $object)
{
foreach ($attributes as $attribute) {
if (\is_a($attribute->getName(), ContextualAttribute::class, \true)) {
Expand Down
12 changes: 12 additions & 0 deletions vendor/illuminate/container/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace RectorPrefix202408\Illuminate\Container;

use Closure;
use RectorPrefix202408\Illuminate\Contracts\Container\ContextualAttribute;
use ReflectionAttribute;
use ReflectionNamedType;
/**
* @internal
Expand Down Expand Up @@ -62,4 +64,14 @@ public static function getParameterClassName($parameter)
}
return $name;
}
/**
* Get a contextual attribute from a dependency.
*
* @param ReflectionParameter $dependency
* @return \ReflectionAttribute|null
*/
public static function getContextualAttributeFromDependency($dependency)
{
return $dependency->getAttributes(ContextualAttribute::class, ReflectionAttribute::IS_INSTANCEOF)[0] ?? null;
}
}

0 comments on commit 082c3ba

Please sign in to comment.