Skip to content

Commit

Permalink
Undo linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rainville committed May 2, 2024
1 parent 9d8fb11 commit 3c18bb9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
14 changes: 6 additions & 8 deletions src/Shortcodes/ImageShortcodeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static function regenerate_shortcode($args, $content, $parser, $shortcode
/**
* Helper method to regenerate all shortcode links.
*
* @param string $value HTML value
* @param string $value HTML value
* @return string value with links resampled
*/
public static function regenerate_html_links($value)
Expand All @@ -227,21 +227,19 @@ public static function getCache()
*/
protected static function find_error_record($errorCode)
{
return Image::create(
[
return Image::create([
'Title' => _t(__CLASS__ . '.IMAGENOTFOUND', 'Image not found'),
]
);
]);
}

/**
* Updated the loading attribute which is used to either lazy-load or eager-load images
* Eager-load is the default browser behaviour so when eager loading is specified, the
* loading attribute is omitted
*
* @param array $args
* @param int|null $width
* @param int|null $height
* @param array $args
* @param int|null $width
* @param int|null $height
* @return array
*/
private static function updateLoadingValue(array $args, ?int $width, ?int $height): array
Expand Down
10 changes: 5 additions & 5 deletions tests/php/ImageManipulationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ public function testGetAttributesWhenLazyLoadIsDisabled()

$this->assertEquals(
[
'width' => $image->getWidth(),
'height' => $image->getHeight(),
'alt' => $image->getTitle(),
'src' => $image->getURL(),
'width' => $image->getWidth(),
'height' => $image->getHeight(),
'alt' => $image->getTitle(),
'src' => $image->getURL(),
],
$image->getAttributes(),
'No loading attribute when lazy loading is disabled globally'
Expand Down Expand Up @@ -275,7 +275,7 @@ public function testIsLazyLoaded()

public function testAttributesHTML()
{
/** @var Image $origin*/
/** @var Image $origin */
$image = $this->objFromFixture(Image::class, 'imageWithTitle');
$this->assertEquals(
'width="300" height="300" alt="This is a image Title" src="/assets/ImageTest/folder/test-image.png" loading="lazy"',
Expand Down
14 changes: 5 additions & 9 deletions tests/php/Shortcodes/ImageShortcodeProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ protected function setUp(): void

// Copy test images for each of the fixture references
$images = Image::get();
/**
* @var Image $image
*/
/** @var Image $image */
foreach ($images as $image) {
$sourcePath = __DIR__ . '/../ImageTest/' . $image->Name;
$image->setFromLocalFile($sourcePath, $image->Filename);
Expand Down Expand Up @@ -89,12 +87,10 @@ public function testShorcodeRegenrator()
$image->ID,
$image->Link()
),
$parser->parse(
sprintf(
'[image id="%d" alt="My alt text" title="My Title & special character"]',
$image->ID
)
),
$parser->parse(sprintf(
'[image id="%d" alt="My alt text" title="My Title & special character"]',
$image->ID
)),
'Shortcode regeneration properly reads attributes'
);

Expand Down

0 comments on commit 3c18bb9

Please sign in to comment.