-
-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Rector to commit dc580ae1bb540eed78d915db46168b39c1469b42
rectorphp/rector-src@dc580ae Fix skip() Rector class, make container forget it comleteely (#4807)
- Loading branch information
1 parent
a2d4674
commit b8fef75
Showing
9 changed files
with
65 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare (strict_types=1); | ||
namespace Rector\Core\DependencyInjection\Laravel; | ||
|
||
use RectorPrefix202308\Illuminate\Container\Container; | ||
use Rector\Core\Util\Reflection\PrivatesAccessor; | ||
/** | ||
* Helper service to modify Laravel container | ||
*/ | ||
final class ContainerMemento | ||
{ | ||
public static function forgetService(Container $container, string $typeToForget) : void | ||
{ | ||
// 1. remove the service | ||
$container->offsetUnset($typeToForget); | ||
// 2. remove all tagged rules | ||
$privatesAccessor = new PrivatesAccessor(); | ||
$privatesAccessor->propertyClosure($container, 'tags', static function (array $tags) use($typeToForget) : array { | ||
foreach ($tags as $tagName => $taggedClasses) { | ||
foreach ($taggedClasses as $key => $taggedClass) { | ||
if (\is_a($taggedClass, $typeToForget, \true)) { | ||
unset($tags[$tagName][$key]); | ||
} | ||
} | ||
} | ||
return $tags; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters